package com.test.study.base;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Demo1 {

    public static void test(String[] args) {

        String next = "hello nowcoder";
        String[] s = next.split(" ");
        String trim = s[s.length - 1].trim();
        System.out.println(trim.length());
    }

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String s = scanner.nextLine();
        String target=scanner.nextLine();
        String tmpStr = s.toUpperCase();
        char[] chars = tmpStr.toCharArray();
        int count=0;
        for (int i = 0; i < chars.length; i++) {
            char c=  chars[i];
            String s1 = String.valueOf(c);
            if(s1.equalsIgnoreCase(target)){
                count+=1;
            }
        }
        System.out.println(count);
    }
}
